<?php

namespace Transform;

class AnswerTransform extends Transform
{
    public function listview()
    {
        return [
            'allows' => ['id', 'body', 'pics', 'create_time', 'comments_count', 'views_count', 'likes_count', 'unlikes_count', 'author', 'human_time', 'is_like', 'is_adopted', 'is_unlike', 'type', 'amount', 'is_paid'],
            'author' => ['trans' => ['name' => 'User', 'method' => 'pub']],
        ];
    }

    public function detail()
    {
        return [
            'allows' => ['id', 'body', 'pics', 'create_time', 'comments_count', 'views_count', 'likes_count', 'unlikes_count', 'author', 'human_time', 'is_like', 'is_adopted', 'is_unlike', 'question', 'type', 'amount', 'is_paid'],
            'author' => ['trans' => ['name' => 'User', 'method' => 'pub']],
            'question' => ['trans' => ['name' => 'Question', 'method' => 'listview']],
        ];
    }

    public function countsOnly()
    {
        return [
            'allows' => ['likes_count', 'unlikes_count', 'is_like', 'is_unlike'],
        ];
    }


}
